package cn.iocoder.yudao.module.recycl.dal.mysql.order;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.recycl.dal.dataobject.order.OrderDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.recycl.controller.admin.order.vo.*;

/**
 * 回收订单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderMapper extends BaseMapperX<OrderDO> {

    default PageResult<OrderDO> selectPage(OrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderDO>()
                .eqIfPresent(OrderDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderDO::getUserId, reqVO.getUserId())
                .likeIfPresent(OrderDO::getUserName, reqVO.getUserName())
                .eqIfPresent(OrderDO::getUserPhone, reqVO.getUserPhone())
                .eqIfPresent(OrderDO::getAddress, reqVO.getAddress())
                .eqIfPresent(OrderDO::getItemTypeId, reqVO.getItemTypeId())
                .eqIfPresent(OrderDO::getItemDesc, reqVO.getItemDesc())
                .betweenIfPresent(OrderDO::getAppointmentTime, reqVO.getAppointmentTime())
                .eqIfPresent(OrderDO::getCollectorId, reqVO.getCollectorId())
                .eqIfPresent(OrderDO::getStatus, reqVO.getStatus())
                .eqIfPresent(OrderDO::getRemarks, reqVO.getRemarks())
                .betweenIfPresent(OrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderDO::getId));
    }

}